<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>商品店家类别管理</title>
	<meta name="decorator" content="default"/>
	<%@include file="/WEB-INF/views/include/treetable.jsp" %>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#treeTable").treeTable({expandLevel : 3});
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/wechat/productCategory/">类别列表</a></li>
		<shiro:hasPermission name="wechat:productCategory:edit"><li><a href="${ctx}/wechat/productCategory/form">类别添加</a></li></shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="productCategory" action="${ctx}/wechat/productCategory/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<label>名称 ：</label><form:input path="name" htmlEscape="false" maxlength="50" class="input-medium"/>
		&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
	</form:form>
	<tags:message content="${message}"/>
	<table id="treeTable" class="table table-striped table-bordered table-condensed">
		<thead><tr><th>名称</th><th>父类别</th><th>类值</th><th>排序</th><th>URL</th><shiro:hasPermission name="wechat:productCategory:edit"><th>操作</th></shiro:hasPermission></tr></thead>
		<tbody>
		<c:forEach items="${list}" var="productCategory">
			<tr id="${productCategory.id}" pId="${productCategory.parent.id ne 1?productCategory.parent.id:'0'}">
				<td> <a href="${ctx}/wechat/productCategory/form?id=${productCategory.id}">${productCategory.name}</a></td>
				<td>${productCategory.parent.name} </td>
				<td>${productCategory.value} </td>
				<td>${productCategory.sort} </td>
				<td>
					<c:if test="${productCategory.parent.id eq 1  or  productCategory.parent.id eq null}">
						http://www.hdzhx.com/zxims/f/wechat/product/?category=${productCategory.value}
    				</c:if>
					<c:if test="${productCategory.parent.id gt 1  }">
						http://www.hdzhx.com/zxims/f/wechat/product/?category=${productCategory.parent.value}&subCategory=${productCategory.value } 
    				</c:if>
				</td>
				<shiro:hasPermission name="wechat:productCategory:edit"><td>
    				<a href="${ctx}/wechat/productCategory/form?id=${productCategory.id}">修改</a>
    				<c:if test="${productCategory.parent.id eq 1  or  productCategory.parent.id eq null}">
	    				<a href="${ctx}/wechat/productCategory/form?parent.id=${productCategory.id}">添加子类别</a>
    				</c:if>
	    				<a href="${ctx}/wechat/product/form?category=${productCategory.parent.value}&subCategory=${productCategory.value}">添加商家</a>
					<a href="${ctx}/wechat/productCategory/delete?id=${productCategory.id}" onclick="return confirmx('确认要删除该商品店家类别吗？', this.href)">删除</a>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
</body>
</html>
